package com.yugao.fintech.libra.model.vo.tenant;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;


@Data
@EqualsAndHashCode(callSuper = true)
public class TenantResp extends TenantBase {
    @Schema(description = "编码", example = "1")
    private Long id;

    @Schema(description = "管理员用户名", example = "test")
    private String userName;

    @Schema(description = "管理员用户id", example = "1")
    private Long adminId;

    @Schema(description = "创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createdAt;

    @Schema(description = "创建者", example = "test")
    private String createdBy;

    @Schema(description = "更新时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updatedAt;

    @Schema(description = "更新者", example = "test")
    private String updatedBy;

    @Schema(description = "租户地址", example = "https://saas.lingyangwl.cn")
    private String url;

    @Schema(description = "租户套餐名称", example = "基础套餐")
    private String packageName;

    @Schema(description = "主租户id")
    private Long mainTenantId;

    @Schema(description = "是否为主租户, mainTenantId = tenantId 则为true")
    private Boolean isMainTenant = false;

    private List<TenantResp> children;

    @Schema(description = "前端树型中需要的参数")
    public String getLabel() {
        return this.getName();
    }

    @Schema(description = "前端树型中需要的参数")
    public String getValue() {
        return String.valueOf(getId());
    }

    public String getKey() {
        return String.valueOf(getId());
    }
}
